<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="UTF-8">
    <title>文件上传</title>
    <style>
        body {
            margin: 0;
            padding: 20px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background: #f8f9fa;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        .upload-container {
            background: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            width: 100%;
            max-width: 400px;
        }

        .upload-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .upload-header h2 {
            margin: 0;
            color: #333;
            font-size: 24px;
            font-weight: 500;
        }

        .upload-form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .file-input-wrapper {
            position: relative;
            border: 2px dashed #dee2e6;
            border-radius: 6px;
            padding: 20px;
            text-align: center;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .file-input-wrapper:hover {
            border-color: #80bdff;
            background: #f8f9fa;
        }

        .file-input-wrapper input[type="file"] {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            cursor: pointer;
        }

        .file-input-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .upload-icon {
            font-size: 40px;
            color: #6c757d;
        }

        .upload-text {
            color: #495057;
            font-size: 16px;
        }

        .upload-hint {
            color: #6c757d;
            font-size: 14px;
        }

        .submit-btn {
            background: #28a745;
            color: #fff;
            border: none;
            padding: 12px 24px;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100%;
        }

        .submit-btn:hover {
            background: #218838;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .submit-btn:active {
            transform: translateY(0);
        }

        .error-message {
            color: #dc3545;
            font-size: 14px;
            text-align: center;
            margin-top: 10px;
            display: none;
        }
    </style>
    <script language="javascript">
        function check() {
            if(document.formAdd.fujian1.value=="") {
                document.getElementById('error-message').style.display = 'block';
                return false;
            }
            return true;
        }

        function handleFileSelect(input) {
            const fileName = input.files[0]?.name;
            if (fileName) {
                document.getElementById('error-message').style.display = 'none';
                document.querySelector('.upload-text').textContent = fileName;
            }
        }
    </script>
</head>
  
<body>
    <div class="upload-container">
        <div class="upload-header">
            <h2>文件上传</h2>
        </div>
        <form action="<%=path %>/upfile/upload1_re.jsp" name="formAdd" method="post" enctype="multipart/form-data" class="upload-form">
            <div class="file-input-wrapper">
                <input type="file" name="fujian1" id="fujian1" onKeyDown="javascript:alert('此信息不能手动输入');return false;" onchange="handleFileSelect(this)" />
                <div class="file-input-content">
                    <div class="upload-icon">📁</div>
                    <div class="upload-text">点击或拖拽文件到此处</div>
                    <div class="upload-hint">支持jpg、png、gif等图片格式</div>
                </div>
            </div>
            <div id="error-message" class="error-message">请选择要上传的文件</div>
            <button type="submit" class="submit-btn" onclick="return check()">上传文件</button>
        </form>
    </div>
</body>
</html>
